package com.example.zhc36.keymanager;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class Sqlhoper extends SQLiteOpenHelper{
    public Sqlhoper(Context context) {
        super(context, "Student", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql="create table moli(" +    //创建数据库
                "_id integer primary key autoincrement," +
                "address text not null," +
                "room text not null," +
                "date text not null)";


        db.execSQL(sql);

        String sql1="insert into moli values(null,?,?,?)";
          db.execSQL(sql1,new  String []{"磨李社区6栋3楼301", "次卧", "2018-09-01"} );
        db.execSQL(sql1,new  String []{"时埂社区12栋4楼402", "隔断", "2019-11-03"} );
        db.execSQL(sql1,new  String []{"龙兴嘉苑3栋2楼202", "主卧", "2018-10-22"} );
    }




    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
